import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('user', { schema: 'db_lowcode' })
export class User {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id', comment: '用户ID' })
  id: number;

  @Column('varchar', { name: 'username', comment: '用户名', length: 50 })
  username: string;

  @Column('varchar', { name: 'head_img', comment: '头像', length: 100 })
  headImg: string;

  @Column('varchar', { name: 'phone', comment: '电话', length: 11 })
  phone: string;

  @Column('varchar', { name: 'password', comment: '密码', length: 50 })
  password: string;

  @Column('varchar', { name: 'salt', comment: 'MD5盐', length: 50 })
  salt: string;

  @Column('varchar', { name: 'open_id', comment: '开放ID', length: 50 })
  openId: string;

  @Column('tinyint', {
    name: 'status',
    comment: '状态1 启用 0 禁用',
    width: 1,
    default: () => "'1'",
  })
  status: boolean;

  @Column('timestamp', {
    name: 'create_time',
    comment: '创建时间',
    default: () => 'CURRENT_TIMESTAMP',
  })
  createTime: Date;

  @Column('timestamp', {
    name: 'update_time',
    comment: '更新时间',
    default: () => 'CURRENT_TIMESTAMP',
  })
  updateTime: Date;
}
